package com.atguigu.tingshu.album.api;

import com.atguigu.tingshu.album.service.TestService;
import com.atguigu.tingshu.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: atguigu
 * @create: 2023-11-17 09:23
 */
@RestController
@RequestMapping("api/album/test")
public class TestController {


    @GetMapping
    public Result hello(){

        return Result.ok();
    }

    //  注入服务层方法
    @Autowired
    private TestService testService;

    /**
     * 测试分布式锁
     * @return
     */
    @GetMapping("testLock")
    public Result testLock(){
        testService.testLock();
        return Result.ok();
    }


    /**
     * 查询数据
     * @return
     */
    @GetMapping("read")
    public Result testRead(){
        testService.testRead();
        return Result.ok();
    }


    /**
     * 修改数据方法
     * @return
     */
    @GetMapping("write")
    public Result testWrite(){
        testService.testWrite();
        return Result.ok();
    }

}
